<script setup>
// 引入reactive
// reactive 只可以传入对象和数组
// reactive 包裹的数据不能直接赋值,比如 person={}
import { reactive } from 'vue';
const person = reactive({
    name: '张三',
    age: 18
})

const changeName = () => person.name = '李四'
const changeAge = () => person.age++

</script>

<template>
    <div>
        <button @click="changeName">修改名字</button>
        <span>{{ person }}</span>
        <button @click="changeAge">修改年龄</button>
    </div>
</template>

<style scoped></style>